package com.xinzhi.utlis;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegUtils {


    private RegUtils(){

    }

    public static boolean check(String target,String regex) {

        // 编译正则表达式
        Pattern pattern = Pattern.compile(regex);

        // 创建匹配器
        Matcher matcher = pattern.matcher(target);

        // 进行匹配
        if (matcher.matches()) {
            return true;
        }
        return false;
    }
}



